#!/usr/bin python3
# -*- coding: utf-8 -*-

from scipy.optimize import fsolve


class Triangle:
    def __init__(self, p: int):
        self.p = p

    def analysis(self) -> int:
        count = 0
        cset = []
        for i in range(1, self.p + 1):
            self.a = i
            _roots = fsolve(self._equation, 0)
            # logging.warning(_roots)
            for b in _roots:
                if b > 0:
                    c = self.p - self.a - int(b)
                    if c not in cset:
                        cset.append(c)
                    else:
                        continue
                    if self.a**2 + b**2 == c**2 and self.a < c and b < c and self.a + b > c:
                        # logging.warning(str(self.a) + ", " + str(b) + ", " + str(c))
                        count += 1
        return count

    def _equation(self, b: int):
        f = (self.p - self.a - b)**2 - self.a**2 - b**2
        return f


if __name__ == "__main__":
    p = input()
    T = Triangle(int(p))
    print(T.analysis())
